﻿using _17单向通道.Entity;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace _17单向通道.EntityConfig;

public class LeaveConfig:IEntityTypeConfiguration<Leave>
{
    public void Configure(EntityTypeBuilder<Leave> builder)
    {
        builder.ToTable("T_Leaves");
        builder.Property(c => c.Remarks).IsUnicode().IsRequired();
        builder.HasOne<User>(l => l.Requester).WithMany().IsRequired().OnDelete(DeleteBehavior.NoAction);
        builder.HasOne<User>(l => l.Approver).WithMany().IsRequired().OnDelete(DeleteBehavior.NoAction);
    }
}